import request from '@/utils/request'

// 目录列表数据
// get 请求 一般情况 是params
export function getDirectorys(params) {
  return request({
    url: '/directorys',
    method: 'get',
    params
  })
}

// 目录状态
export function stateDirectorys(id, state) {
  return request({
    url: `/directorys/${id}/${state}`,
    method: 'post'
  })
}

// 目录删除
export function delDirectorys(id) {
  return request({
    url: `/directorys/${id}`,
    method: 'delete'
  })
}

// 目录修改
// put 一般情况要用data
export function editDirectorys(data) {
  console.log(data)
  return request({
    url: '/directorys/' + data.id,
    method: 'put',
    data
  })
}

// 目录添加
export function addDirectorys(data) {
  console.log(data)
  return request({
    url: '/directorys',
    method: 'post',
    data
  })
}

// 目录详情
export function xiangDirectorys(id) {
  return request({
    url: '/directorys/' + id,
    method: 'get'
  })
}
